package seqList.LeetCode;
//LeetCode 第141题 环形链表 判断链表是否成环
public class Num141 {
    public boolean hasCycle(ListNode head) {
        //快慢指针
        ListNode fast = head;
        ListNode low = head;
        //判断链表至少有两个节点
        while (fast != null && fast.next != null){
            fast = fast.next.next;
            low = low.next;
            if(fast == low){
                return true;
            }
        }
        return false;

    }
}
